﻿using Amber.Arch.Catty;
using Microsoft.AspNetCore.Mvc;

namespace Amber.Arch.Web.Controllers
{
    [Route("v1/[controller]")]
    [ApiController]
    public class FooController : ControllerBase
    {
        private readonly IFoo _foo;
        private readonly ILogger<FooController> _logger;
        private readonly IServiceProvider _serviceProvider;
        public FooController(ILogger<FooController> logger, IServiceProvider serviceProvider, IFoo foo)
        {
            _logger = logger;
            _serviceProvider = serviceProvider;
            _foo = foo;
        }

        [HttpGet]
        public string Get()
        {
            _logger.LogInformation($"{nameof(FooController)}");
            var serviceLocator = _serviceProvider.GetService<IFoo>();
            return _foo.CreateFoo();
        }
    }
}
